import 'package:flutter/material.dart';

class SwitchAndCheckDemo extends StatefulWidget {
  @override
  _SwitchAndCheckDemoState createState() => _SwitchAndCheckDemoState();
}
   
class _SwitchAndCheckDemoState extends State<SwitchAndCheckDemo> {
  bool _switchSelect=true;
  bool _checkBoxSelect=true;
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('Switch'),
      ),
      body: Center(child:  Column(children: [
 Switch(value: _switchSelect, onChanged: (value){
        setState(() {
          _switchSelect = value;
        });

      }),
         Checkbox(activeColor: Colors.red,
      value: _checkBoxSelect,
      onChanged: (info){
       
                  _checkBoxSelect = info!;

        setState(() {
        });

      },
      ),
      ],)
     
   
      ),
    );
  }
   
/*
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Switch(
              value: _switchSelect,
              onChanged: (value) {
                setState(() {
                  _switchSelect=!value;
                });
              }),
          Checkbox(
              value: _checkBoxSelect,
              activeColor: Colors.red,
              onChanged: (value) {
                 _checkBoxSelect=!value!;

                setState(() {
                });
              })
        ],
      ),
    );
  }*/
}
